<?php
	include('functions.php');
	date_default_timezone_set('Europe/Copenhagen');	
	
	$runs = 10;

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','0', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.21
	query('q2.2','0', $i); 
}

// INDEX	
index('posts', array('rating' => 1));

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','1', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.2
	query('q2.2','1', $i); 
}

// INDEX
$cursor = q('posts')->deleteIndexes(); 
index('posts', array('rating' => -1, 'date' => 1));

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','1', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.2
	query('q2.2','1', $i); 
}

// INDEX
index('posts', array('tags' => 1));

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','1', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.2
	query('q2.2','1', $i); 
}

// INDEX
$cursor = q('posts')->deleteIndexes();
index('posts', array('rating' => -1, 'tags' => 1, 'date' => 1));

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','1', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.2
	query('q2.2','1', $i); 
}

// INDEX
$cursor = q('posts')->deleteIndexes(); 
index('posts', array('rating' => -1, 'tags' => 1));

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.1
	query('q2.1','1', $i); 
}

l('Find rating higher than 15, and less than or equal to 22, and tags which is either War or Polictics, sorted by rating descending and date ascending - Time: '	. date("d / m - Y H:i:s", time()));
for($i=0; $i<$runs; $i++) {
	// run query q2.2
	query('q2.2','1', $i); 
}

echo "DONE!";
	
?>